<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>用户管理--layui后台管理模板</title>
	<meta name="renderer" content="webkit"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="format-detection" content="telephone=no"/>
	<link rel="stylesheet" href="/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" href="/css/font_eolqem241z66flxr.css" media="all"/>
	<link rel="stylesheet" href="/css/user.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" id="pageForm" name="pageForm" action="/manager_user_list" method="post">
	<blockquote class="layui-elem-quote news_search">
		<div class="layui-inline">
		    <div class="layui-input-inline">
		    	<input type="text" name="name" th:value="${name}" placeholder="请输入真实姓名或昵称" class="layui-input search_input"/>
		    </div>
		    <button class="layui-btn search_btn" type="submit">查询</button>
		</div>
		<div class="layui-inline">
			<div class="layui-input-inline">
				<select name="state" >
					<option value="">请选择身份</option>
					<option value="">&nbsp;&nbsp;&nbsp;&nbsp;</option>
					<option value="0" th:selected="${state == 0}">业务员</option>
					<option value="1" th:selected="${state == 1}">游客</option>
				</select>
			</div>
			<button class="layui-btn search_btn" type="submit">查询</button>
		</div>
		<div class="layui-inline">
			<a class="layui-btn layui-btn-normal" th:href="|/manager_user_toadd|">添加业务员</a>
		</div>
	</blockquote>
	<div class="layui-form news_list">
	  	<table class="layui-table">
		    <colgroup>
				<col width="5%"/>
				<col width="7%"/>
				<col width="9%"/>
				<col width="12%"/>
				<col width="9%"/>
				<col width="12%"/>
				<col width="12%"/>
				<col width="7%"/>
				<col width="17%"/>
		    </colgroup>
		    <thead>
				<tr>
					<!--<th><input type="checkbox" name="" title=""/></th>-->
					<th>序号</th>
					<th>昵称</th>
					<th>头像</th>
					<th>openid</th>
					<th>手机号码</th>
					<th>添加时间</th>
					<th>修改时间</th>
					<th>状态</th>
					<th>操作</th>
				</tr> 
		    </thead>
		    <tbody class="users_content">
			<tr th:each="var,iterStat: ${pagerHelper.records}">
				<!--<td><input type="checkbox" name="" title=""/></td>-->
				<td th:text="${iterStat.count}"></td>
				<td th:text="${var.userName}"></td>
				<td><img th:src="${var.imgurl}" width="60px" height="60px"></td>
				<td th:text="${var.openid}"></td>
				<td th:text="${var.linkTel}"></td>
				<td th:text="${var.addTime}"></td>
				<td th:text="${var.modifyTime}"></td>
					<td th:if="${var.state==0}">业务员</td>
					<td th:if="${var.state==1}">游客</td>
				<td>
					<div class="layui-btn-group">
					<a class="layui-btn layui-btn-xs" th:href="|/manager_user_todetail/${var.id}|" style="background:#4CAF50;border-radius: 20%">
<!--						<i class="layui-icon">&#xe60a;</i>-->
						查看
					</a>
					<a class="layui-btn layui-btn-xs layui-btn-normal" th:href="|/manager_user_toEdit/${var.id}|">
<!--						<i class="layui-icon">&#xe642;</i>-->
						编辑
					</a>
					<a class="layui-btn layui-btn-xs layui-btn-danger"  th:href="|javascript:manager_user_delete('${var.id}')|">
<!--						<i class="layui-icon">&#xe640;</i>-->
						删除
					</a>
					</div>
<!--					<input type="checkbox" name="enable" title="业务员启用" checked>-->
				</td>
			</tr>
			</tbody>
		</table>
	</div>
		<div class="layui-table-page">
			<div id="layui-table-page1">
				<div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-2">
					<span class="layui-laypage-count" th:text="'共'+${pagerHelper.totalCount}+'条'"></span>
					<span class="layui-laypage-skip">
						<input type="number" name="pageNumber" id="pageNumber" th:value="${pagerHelper.pageNumber}"
							   class="layui-input"/></span>
					<span class="layui-laypage-limits">
						<a class="layui-btn toPage">跳转</a>
						<a class="layui-btn toPageOne">首页</a>
						<a class="layui-btn previousPage"><i class="layui-icon"></i></a>
						<a class="layui-btn nextPage"><i class="layui-icon"></i></a>
						<a class="layui-btn toPageLast">尾页</a>
					</span>
					<span class="layui-laypage-count" th:text="'共'+${pagerHelper.pageCount}+'页'"></span>
					<span class="layui-laypage-limits">
						<select lay-ignore="" id="pageSize" name="pageSize">
							<option value="7" th:selected="${pagerHelper.pageSize==7?'selected':'false'}">7 条/页</option>
							<option value="20"
									th:selected="${pagerHelper.pageSize==20?'selected':'false'}">20 条/页</option>
							<option value="30"
									th:selected="${pagerHelper.pageSize==30?'selected':'false'}">30 条/页</option>
							<option value="40"
									th:selected="${pagerHelper.pageSize==40?'selected':'false'}">40 条/页</option>
							<option value="50"
									th:selected="${pagerHelper.pageSize==50?'selected':'false'}">50 条/页</option>
							<option value="60"
									th:selected="${pagerHelper.pageSize==60?'selected':'false'}">60 条/页</option>
							<option value="70"
									th:selected="${pagerHelper.pageSize==70?'selected':'false'}">70 条/页</option>
							<option value="80"
									th:selected="${pagerHelper.pageSize==80?'selected':'false'}">80 条/页</option>
							<option value="90"
									th:selected="${pagerHelper.pageSize==90?'selected':'false'}">90 条/页</option>
							<option value="100"
									th:selected="${pagerHelper.pageSize==100?'selected':'false'}">100 条/页</option>
						</select>
					</span>
				</div>
			</div>
		</div>
	<input type="hidden" id="count" name="count" th:value="${pagerHelper.totalCount}"/>
	<input type="hidden" id="size" name="size" th:value="${pagerHelper.pageCount}"/>
	</form>
	<script type="text/javascript" src="/layui/layui.js"></script>
	<script type="text/javascript" src="/js/user/allUsers.js"></script>
	<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
	<script type="text/javascript">


		/**
		 * 删除用户
		 * @param id
		 */
		function manager_user_delete(id) {
			//询问框
			layer.confirm('确定删除该条数据嘛?', {
				btn: ['确定','取消'] //按钮
			}, function(){
				$.getJSON("/manager_user_delete/"+id,function (result) {
					if(result.code==200){
						layer.msg('删除成功', {
							time: 2000, //2s后自动关闭
						},function () {
							location.href="/manager_user_list";
						});
					}else{
						layer.msg('删除失败', {
							time: 2000, //2s后自动关闭
						});
					}
				});
			});
		}

	</script>
</body>
</html>